<%@page import="helpers.LanguageHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.TreeMap"%>
<%@page import="entities.User"%>
<%
User user = (User) request.getAttribute("user");
TreeMap check = (TreeMap) request.getAttribute("check");
String success = (String) request.getAttribute("success");
%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/user/layouts/header.jsp" />

			<ul class="nav nav-tabs">
                <li class="active">
                    <a href="/profile"><i class="icon-tasks"></i> Profile</a>
                </li>
                <li>
                    <a href="/profile/change-avatar"><i class="icon-briefcase"></i> Change Avatar</a>
                </li>
                <li>
                    <a href="/profile/article/list"><i class="icon-briefcase"></i> My Articles</a>
                </li>
                <li>
                    <a href="/profile/article/submit"><i class="icon-envelope"></i> Submit Article</a>
                </li>
            </ul>
            <div class="tab-content">
            	<div id="resume-tab" class="tab-pane row-fluid active fade in">
            		<% if (success != null) { %>
		            <div class="alert alert-success"><%=success %></div>
		            <% } %>
            		<h3 class="my-caption">Personal Information</h3>
					<form method="post" action="" class="form-horizontal">
						<div class="row-fluid">
							<div class="span12">
								<div class="row-fluid">
                                     <div class="span8 control-group <%=check.get("name") != null ? "error" : ""%>">
                                         <label><i class="icon-eye-open"></i> Display Name</label>
                                          <input type="text" id="inputName" name="name" placeholder="Name" value="<%=user.getName() %>" class="input-block-level">
									<% if (check.get("name") != null) { %>
									<br />
		                            <span class="help-inline"><%=check.get("name") %></span>
		                            <% } %>
                                     </div>
                                     <div class="span4 control-group <%=check.get("gender") != null ? "error" : ""%>">
                                     	<label><i class="icon-user"></i> Gender</label>
                                         <select name="gender" id="inputGender" class="input-block-level">
			                        	<option value="0" <%=user.getGender() == 0 ? "selected=\"selected\"" : ""%>>Male</option>
			                        	<option value="1" <%=user.getGender() == 1 ? "selected=\"selected\"" : ""%>>Female</option>
			                        </select>
			                        <% if (check.get("gender") != null) { %>
			                        <br />
		                            <span class="help-inline"><%=check.get("gender") %></span>
		                            <% } %>
                                    </div>
                                </div>

								<div class="control-group <%=check.get("email") != null ? "error" : ""%>">
                                	<label><i class="icon-envelope"></i> Email address</label>
                                	<input type="text" id="inputEmail" name="email" placeholder="Email address" value="<%=user.getUsername() %>" class="input-block-level">
									<% if (check.get("email") != null) { %>
									<br />
			                        <span class="help-inline"><%=check.get("email") %></span>
			                        <% } %>
                                        
                                </div>

								<div class="control-group <%=check.get("website") != null ? "error" : ""%>">
                                	<label><i class="icon-globe"></i> website url</label>
                                    <input type="text" id="inputWebsite" name="website" placeholder="Website url" value="<%=user.getWebsite()%>"  class="input-block-level">
									<% if (check.get("website") != null) { %>
		                            <span class="help-inline"><%=check.get("website") %></span>
		                            <% } %>             
                                </div>

								
								<div class="control-group">
                                	<label><i class="icon-comment"></i> About me</label>
                                    <textarea rows="8" id="inputAboutme" name="aboutme" placeholder="About Me" class="input-block-level"><%=user.getAboutme() %></textarea>
									<% if (check.get("aboutme") != null) { %>
			                         <span class="help-inline"><%=check.get("aboutme") %></span>
			                        <% } %>                     
                                </div>   
								
								<button type="submit" class="btn btn-primary">Change my profile</button>
							</div>
						</div>
					</form>
				</div>
            </div>

<jsp:include page="/user/layouts/footer.jsp" />